package com.lgqz.himalayafm.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

/**
 * Created by Administrator on 2016/12/5.
 */

public class CategoriesViewPagerAdapter extends PagerAdapter {
    private List<SimpleDraweeView> imgList;

    public CategoriesViewPagerAdapter(List<SimpleDraweeView> imgList) {
        this.imgList = imgList;
    }
    @Override
    public int getCount() {
        return imgList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(imgList.get(position));
        return imgList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(imgList.get(position));
    }
}
